package SGEngine2

import (
//"fmt"
//"github.com/gl"
//"strings"
)

type Texture struct {
	Component2D
	Node      *Node
	Color     Color4
	ImageName string
}

func (t *Texture) OnAttach(node *Node) {
	t.Component2D.OnAttach(node)
	node.render.Mat = t.GenTextureMaterial(t.ImageName)
	b := node.render.Mat.Tex.Texture.Bounds()
	t.Component2D.SetSize(float32(b.Dx()), float32(b.Dy()))
	node.render.RenderMesh = t.Component2D.GenQuadMesh(&t.Color, true)

}

func (t *Texture) OnDetach(node *Node) {

}

func (t *Texture) OnUpdate() {

}
